<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        overflow: hidden;
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      canvas {
        display: block;
        border: 1px solid #000;
        overflow: hidden;
      }
    </style>
  </head>
  <body>
    <canvas id="canvas" width="500" height="500"></canvas>
    <script>
      const canvas = document.querySelector("#canvas");
      const context = canvas.getContext("2d");

      let x = 600;
      function animate() {
        x--;
        context.clearRect(0, 0, 500, 500);

        context.beginPath();
        context.fillStyle = "red";
        context.font = "30px sans-serif";

        context.fillText("hellow", x, 200);
        context.closePath();
        requestAnimationFrame(animate);
        if (x < 0) {
          x = 600;
        }
      }
      animate();
    </script>
  </body>
</html>
